import request from '@/utils/request'

// 查询看板订单列表
export function listKanbanOrder(query) {
  return request({
    url: '/kanban/order/list',
    method: 'get',
    params: query
  })
}

// 导出看板订单列表
export function exportKanbanOrder(query) {
  return request({
    url: '/kanban/order/export',
    method: 'post',
    data: query
  })
}

// 查询看板订单详情
export function getKanbanOrder(id) {
  return request({
    url: '/kanban/order/' + id,
    method: 'get'
  })
}

// 根据看板编码获取看板订单信息
export function getKanbanOrderByCode(kanbanCode) {
  return request({
    url: '/kanban/order/code/' + kanbanCode,
    method: 'get'
  })
}

// 新增看板订单
export function addKanbanOrder(data) {
  return request({
    url: '/kanban/order',
    method: 'post',
    data
  })
}

// 修改看板订单
export function updateKanbanOrder(data) {
  return request({
    url: '/kanban/order',
    method: 'put',
    data
  })
}

// 删除看板订单（支持批量）
export function delKanbanOrder(ids) {
  return request({
    url: '/kanban/order/' + ids,
    method: 'delete'
  })
}

// 根据框架协议ID查询看板订单列表
export function getKanbanOrdersByFrameworkId(frameworkId) {
  return request({
    url: '/kanban/order/framework/' + frameworkId,
    method: 'get'
  })
}

// 根据业务状态查询看板订单列表
export function getKanbanOrdersByStatus(businessStatus) {
  return request({
    url: '/kanban/order/status/' + businessStatus,
    method: 'get'
  })
}

// 统计看板订单数量
export function getKanbanOrderStatistics(params) {
  return request({
    url: '/kanban/order/statistics',
    method: 'get',
    params
  })
}

// 批量更新看板订单状态
export function updateKanbanOrderStatusBatch(ids, businessStatus) {
  return request({
    url: '/kanban/order/status',
    method: 'put',
    params: {
      ids: ids,
      businessStatus: businessStatus
    }
  })
}

// 发货方确认看板订单
export function confirmKanbanOrderBySender(id, confirmRemark) {
  return request({
    url: '/kanban/order/confirm/' + id,
    method: 'put',
    params: {
      confirmRemark: confirmRemark
    }
  })
}

// 打印箱标
export function printBoxLabel(id) {
  return request({
    url: '/kanban/order/print/boxLabel/' + id,
    method: 'put'
  })
}

// 打印看板
export function printKanban(id) {
  return request({
    url: '/kanban/order/print/kanban/' + id,
    method: 'put'
  })
}